<template>
    <div class="office-wrap" v-title :data-title="headTitle">
        <headerTop :title="headTitle"></headerTop>
        <selectProject :projectName="selectProjectName" :infoId="infoId"/>
        <div class="office-content-repair itemMargin-bot" v-if="repairStatus">
            <div class="repair-title">
                <span>补报</span>
                <span>日期</span>
            </div>
            <div class="item-content">
                <van-field v-model="info.repairDate" placeholder="请输入格式为20200925的日期" label-width="75"/>
            </div>
        </div>
        <div class="office-content">
            <span class="item-title">整理</span>
            <div class="item-content">
                <div class="item-arrow-down" @click="openZhengliOpen=!openZhengliOpen">
                    <span :style="{color:(info.zhengNum || info.zhengMark)?'#007CF9':'#7D8082'}">
                        {{info.zhengNum || info.zhengMark?'已填写':'未填写'}}
                    </span>
                    <van-icon :name="openZhengliOpen?'arrow-up':'arrow-down'" />
                </div>
                <div v-if="openZhengliOpen">
                    <van-field v-model="info.zhengNum" maxlength="9" type="digit" label="数量(件)" placeholder="请输入整理件数"
                               label-width="75"/>
                    <van-field v-model="info.zhengMark" type="textarea" label="补充描述" placeholder="请输入整理补充描述"
                               label-width="75"
                               rows="2" :autosize="true"/>
                </div>

            </div>
        </div>
        <div class="office-content itemMargin">
            <span class="item-title">敲页码</span>
            <div class="item-content">
                <div class="item-arrow-down" @click="qiaoYeMaOpen=!qiaoYeMaOpen">
                    <span :style="{color:(info.qiaoNum || info.qiaoPage || info.qiaoMark)?'#007CF9':'#7D8082'}">
                        {{info.qiaoNum || info.qiaoPage || info.qiaoMark?'已填写':'未填写'}}
                    </span>
                    <van-icon :name="qiaoYeMaOpen?'arrow-up':'arrow-down'" />
                </div>
                <div v-if="qiaoYeMaOpen">
                    <van-field v-model="info.qiaoNum" maxlength="9" type="digit" label="数量(件)" placeholder="请输入敲页码件数"
                               label-width="75"/>
                    <van-field v-model="info.qiaoPage" maxlength="9" type="digit" label="数量(页)" placeholder="请输入敲页码页数"
                               label-width="75"/>
                    <div class="office-desc">
                        <div class="office-desc-input">
                            <van-field v-model="info.qiaoMark" type="textarea" label="补充描述" placeholder="请输入敲页码补充描述"
                                       label-width="75"
                                       rows="2" :autosize="true"/>
                        </div>
                        <div class="office-desc-add" @click="addContent('qiaoCode')">
                            <van-icon name="add" size="30" color="#007CF9"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="office-content itemMargin">
            <span class="item-title">敲章</span>
            <div class="item-content">
                <div class="item-arrow-down" @click="qiaoZhangOpen=!qiaoZhangOpen">
                    <span :style="{color:(info.zhangNum || info.zhangMark)?'#007CF9':'#7D8082'}">
                        {{info.zhangNum || info.zhangMark?'已填写':'未填写'}}
                    </span>
                    <van-icon :name="qiaoZhangOpen?'arrow-up':'arrow-down'" />
                </div>
                <div v-if="qiaoZhangOpen">
                    <van-field v-model="info.zhangNum" maxlength="9" type="digit" label="数量(件)" placeholder="请输入敲章件数"
                               label-width="75"/>
                    <div class="office-desc">
                        <div class="office-desc-input">
                            <van-field v-model="info.zhangMark" type="textarea" label="补充描述" placeholder="请输入敲章补充描述"
                                       label-width="75"
                                       rows="2" :autosize="true"/>
                        </div>
                        <div class="office-desc-add" @click="addContent('qiaoZhang')">
                            <van-icon name="add" size="30" color="#007CF9"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="office-content itemMargin">
            <span class="item-title">录入</span>
            <div class="item-content">
                <div class="item-arrow-down" @click="luRuOpen=!luRuOpen">
                    <span :style="{color:(info.luNum || info.luMark)?'#007CF9':'#7D8082'}">
                        {{info.luNum || info.luMark?'已填写':'未填写'}}
                    </span>
                    <van-icon :name="luRuOpen?'arrow-up':'arrow-down'" />
                </div>
                <div v-if="luRuOpen">
                    <van-field v-model="info.luNum" maxlength="9" type="digit" label="数量(件)" placeholder="请输入录入件数"
                               label-width="75"/>
                    <div class="office-desc">
                        <div class="office-desc-input">
                            <van-field v-model="info.luMark" type="textarea" label="补充描述" placeholder="请输入录入补充描述"
                                       label-width="75"
                                       rows="2" :autosize="true"/>
                        </div>
                        <div class="office-desc-add" @click="addContent('lu')">
                            <van-icon name="add" size="30" color="#007CF9"/>
                        </div>
                    </div>
                </div>


            </div>
        </div>
        <div class="office-content itemMargin">
            <span class="item-title">扫描</span>
            <div class="item-content">
                <div class="item-arrow-down" @click="saoMiaoOpen=!saoMiaoOpen">
                    <span :style="{color:(info.scanNum || info.scanPage || info.scanMark)?'#007CF9':'#7D8082'}">
                        {{info.scanNum || info.scanPage || info.scanMark?'已填写':'未填写'}}
                    </span>
                    <van-icon :name="saoMiaoOpen?'arrow-up':'arrow-down'" />
                </div>
                <div v-if="saoMiaoOpen">
                    <van-field v-model="info.scanNum" maxlength="9" type="digit" label="数量(件)" placeholder="请输入扫描件数"
                               label-width="75"/>
                    <van-field v-model="info.scanPage" maxlength="9" type="digit" label="数量(页)" placeholder="请输入扫描页数"
                               label-width="75"/>
                    <div class="office-desc">
                        <div class="office-desc-input">
                            <van-field v-model="info.scanMark" type="textarea" label="补充描述" placeholder="请输入扫描补充描述"
                                       label-width="75"
                                       rows="2" :autosize="true"/>
                        </div>
                        <div class="office-desc-add" @click="addContent('scan')">
                            <van-icon name="add" size="30" color="#007CF9"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="office-content itemMargin">
            <span class="item-title">装订</span>
            <div class="item-content">
                <div class="item-arrow-down" @click="zhuangDingOpen=!zhuangDingOpen">
                    <span :style="{color:(info.zhaungNum || info.zhaungMark)?'#007CF9':'#7D8082'}">
                        {{info.zhaungNum || info.zhaungMark?'已填写':'未填写'}}
                    </span>
                    <van-icon :name="zhuangDingOpen?'arrow-up':'arrow-down'" />
                </div>
                <div v-if="zhuangDingOpen">
                    <van-field v-model="info.zhaungNum" maxlength="9" type="digit" label="数量(件)" placeholder="请输入装订件数"
                               label-width="75"/>
                    <div class="office-desc">
                        <div class="office-desc-input">
                            <van-field v-model="info.zhaungMark" type="textarea" label="补充描述" placeholder="请输入装订补充描述"
                                       label-width="75"
                                       rows="2" :autosize="true"/>
                        </div>
                        <div class="office-desc-add" @click="addContent('zhuang')">
                            <van-icon name="add" size="30" color="#007CF9"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="office-content itemMargin">
            <span class="item-title">其他</span>
            <div class="item-content">
                <van-field v-model="info.otherMark" type="textarea" label="其他描述" placeholder="请输入其他补充描述"
                           label-width="70"
                           rows="2" :autosize="true"/>
            </div>
        </div>
        <div class="office-content itemMargin">
            <span class="item-title">工作量</span>
            <div class="item-content">
                <div class="item-arrow-down" @click="workOpen=!workOpen">
                    <span :style="{color:workDay?'#007CF9':'#7D8082'}">
                        {{workDay?'已填写':'未填写'}}
                    </span>
                    <van-icon :name="workOpen?'arrow-up':'arrow-down'" />
                </div>
                <div v-if="workOpen">
                    <div class="work-day">
                        <span class="work-day-title">工作量</span>
                        <span class="work-day-select" :style="{color:workDay?'#323233':'#969799'}"
                              @click="selectWorkDay">{{workDay?workDay+'天':'请选择工作量'}}</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="person-commit">
            <van-button round type="info" style="width: 100%;font-size: 18px;" @click="startCommit">{{repairStatus?'申请':'填报'}}</van-button>
        </div>
        <van-popup v-model="isShowSelectWorkPopu" position="bottom" round>
            <van-picker
                    title="请选择工作量"
                    show-toolbar
                    :columns="columnsWork"
                    :default-index="0"
                    :visible-item-count="6"
                    @confirm="onConfirmWork"
                    @cancel="onCancelWorok"/>
        </van-popup>
        <van-popup v-model="isShowSupportPopu" position="bottom" closeable round>
            <div class="support-popu">
                <!--<div class="support-year" @click="selectYears">
                    <span class="year-left">年限</span>
                    <span class="year-right">{{supportInfo.year?supportInfo.year:'请选择年限'}}</span>
                </div>-->
                <van-field v-model="supportInfo.year" maxlength="4" type="digit" label="年限" placeholder="请输入年限,如2020"
                           label-width="75"/>
                <div class="line"></div>
                <div class="support-year" @click="selectYear">
                    <span class="year-left">时限</span>
                    <span class="year-right">{{supportInfo.yearTime?supportInfo.yearTime:'请选择时限'}}</span>
                </div>
                <div class="line"></div>
                <van-field v-model="supportInfo.totalNum" maxlength="9" type="digit" label="总件数" placeholder="请输入总件数"
                           label-width="75"/>
                <van-field v-model="supportInfo.startNum" maxlength="9" type="digit" label="开始件数" placeholder="请输入开始件数"
                           label-width="75"/>
                <van-field v-model="supportInfo.endNum" maxlength="9" type="digit" label="结束件数" placeholder="请输入结束件数"
                           label-width="75"/>
                <div class="support-add" @click="commitSupport">确定</div>
            </div>
        </van-popup>

        <van-popup v-model="isShowSelectPopu" position="bottom" round>
            <van-picker
                    title="请选择时效"
                    show-toolbar
                    :columns="columns"
                    :default-index="1"
                    :visible-item-count="6"
                    @confirm="onConfirm"
                    @cancel="onCancel"/>
        </van-popup>
        <van-popup v-model="isShowSelectYearPopu" position="bottom" round>
            <van-picker
                    tsysModifyDataitle="请选择年份"
                    show-toolbar
                    :columns="columnsYear"
                    :default-index="20"
                    :visible-item-count="6"
                    @confirm="onConfirmYear"
                    @cancel="onCancelYear"/>
        </van-popup>

        <van-popup v-model="isShowCommitPopu" position="bottom" round closeable>
            <div class="commit-show" :style="{maxHeight:screenHeight>500?commitPopuHeight+'px':screenHeight+'px'}">
                <div class="commit-title">{{repairStatus?'申请信息确认':'填报信息确认'}}</div>
                <div class="commit-item">
                    <span class="commit-item-title">项目</span>
                    <div class="commit-item-content">
                        <span>{{selectProjectName}}</span>
                    </div>
                </div>
                <div class="bottomLine"></div>
                <div class="commit-item" v-if="repairStatus">
                    <span class="commit-item-title">补报日期</span>
                    <div class="commit-item-content">
                        <span>{{info.repairDate}}</span>
                    </div>
                </div>
                <div class="bottomLine" v-if="repairStatus"></div>
                <div class="commit-item" v-if="info.zhengNum || info.zhengMark">
                    <span class="commit-item-title">整理</span>
                    <div class="commit-item-content">
                        <span v-if="info.zhengNum">数量(件)：{{info.zhengNum}}</span>
                        <span class="item-txt-top" v-if="info.zhengMark">补充描述：{{info.zhengMark}}</span>
                    </div>
                </div>
                <div class="bottomLine" v-if="info.zhengNum || info.zhengMark"></div>
                <div class="commit-item" v-if="info.qiaoNum || info.qiaoPage || info.qiaoMark">
                    <span class="commit-item-title">敲页码</span>
                    <div class="commit-item-content">
                        <span v-if="info.qiaoNum">数量(件)：{{info.qiaoNum}}</span>
                        <span class="item-txt-top" v-if="info.qiaoPage">数量(页)：{{info.qiaoPage}}</span>
                        <span class="item-txt-top" v-if="info.qiaoMark">补充描述：{{info.qiaoMark}}</span>
                    </div>
                </div>
                <div class="bottomLine" v-if="info.qiaoNum || info.qiaoPage || info.qiaoMark"></div>

                <div class="commit-item" v-if="info.zhangNum || info.zhangMark">
                    <span class="commit-item-title">敲章</span>
                    <div class="commit-item-content">
                        <span v-if="info.zhangNum">数量(件)：{{info.zhangNum}}</span>
                        <span class="item-txt-top" v-if="info.zhangMark">补充描述：{{info.zhangMark}}</span>
                    </div>
                </div>
                <div class="bottomLine" v-if="info.zhangNum || info.zhangMark"></div>

                <div class="commit-item" v-if="info.luNum || info.luMark">
                    <span class="commit-item-title">录入</span>
                    <div class="commit-item-content">
                        <span v-if="info.luNum">数量(件)：{{info.luNum}}</span>
                        <span class="item-txt-top" v-if="info.luMark">补充描述：{{info.luMark}}</span>
                    </div>
                </div>
                <div class="bottomLine" v-if="info.luNum || info.luMark"></div>

                <div class="commit-item" v-if="info.scanNum || info.scanPage || info.scanMark">
                    <span class="commit-item-title">扫描</span>
                    <div class="commit-item-content">
                        <span v-if="info.scanNum">数量(件)：{{info.scanNum}}</span>
                        <span class="item-txt-top" v-if="info.scanPage">数量(页)：{{info.scanPage}}</span>
                        <span class="item-txt-top" v-if="info.scanMark">补充描述：{{info.scanMark}}</span>
                    </div>
                </div>
                <div class="bottomLine" v-if="info.scanNum || info.scanPage || info.scanMark"></div>

                <div class="commit-item" v-if="info.zhaungNum || info.zhaungMark">
                    <span class="commit-item-title">装订</span>
                    <div class="commit-item-content">
                        <span v-if="info.zhaungNum">数量(件)：{{info.zhaungNum}}</span>
                        <span class="item-txt-top" v-if="info.zhaungMark">补充描述：{{info.zhaungMark}}</span>
                    </div>
                </div>
                <div class="bottomLine" v-if="info.zhaungNum || info.zhaungMark"></div>

                <div class="commit-item" v-if="info.otherMark">
                    <span class="commit-item-title">其他</span>
                    <div class="commit-item-content">
                        <span v-if="info.otherMark">其他描述：{{info.otherMark}}</span>
                    </div>
                </div>
                <div class="bottomLine" v-if="info.otherMark"></div>
                <div class="commit-item" v-if="workDay">
                    <span class="commit-item-title">工作量</span>
                    <div class="commit-item-content">
                        <span>{{workDay+'天'}}</span>
                    </div>
                </div>
                <div class="bottomLine" v-if="workDay"></div>

                <div class="person-commit-notice">
                    <van-button round type="info" style="width: 100%;font-size: 18px;" @click="startSureCommit">{{repairStatus?'确认申请':'确认填报'}}
                    </van-button>
                </div>
            </div>
        </van-popup>
    </div>
</template>

<script>
    import headerTop from "@/components/headerTop";
    import selectProject from "@/components/selectProject"
    import {dismissLoading, nofity, showLoading, toast} from "@/utils/notify"

    export default {
        name: "officeArchives",
        components: {
            headerTop,
            selectProject
        },
        data() {
            return {
                openZhengliOpen:false,
                qiaoYeMaOpen:false,
                qiaoZhangOpen:false,
                luRuOpen:false,
                saoMiaoOpen:false,
                zhuangDingOpen:false,
                headTitle:"文书档案",
                isShowCommitPopu: false,
                isShowSupportPopu: false,
                isShowSelectPopu: false,
                isShowSelectYearPopu: false,
                selectProjectName: '',
                selectProjectId: '',
                supportInfo: {
                    allInfo: '',
                    startNum: '',
                    endNum: '',
                    yearTime: '',
                    year:'',
                    totalNum:''
                },
                info: {
                    zhengNum: '',
                    zhengMark: '',
                    qiaoNum: '',
                    qiaoPage: '',
                    qiaoMark: '',
                    zhangNum: '',
                    zhangMark: '',
                    luNum: '',
                    luMark: '',
                    scanNum: '',
                    scanPage: '',
                    scanMark: '',
                    zhaungNum: '',
                    zhaungMark: '',
                    otherMark: '',
                    repairDate:'',
                },
                columns: ['永久', '30年', '10年'],
                columnsYear:["2000","2001","2002","2003","2004","2005","2006","2007","2008","2009","2000","2011","2012","2013","2014","2015","2016","2017","2018","2019","2020","2021","2022","2023","2024","2025"],
                popuLocationFlag: '',
                repairStatus: false,
                commitPopuHeight: 0,
                screenHeight: 0,
                infoId: '',
                isSelectProject:false,
                projectType:'',
                modifyManager:0,
                isShowSelectWorkPopu:false,
                workDay:'',
                workOpen:false,
                columnsWork: ['0.5天', '1天'],
            }
        },
        methods: {
            onConfirmWork(value){
                if (value=='0.5天'){
                    this.workDay='0.5'
                }else {
                    this.workDay='1'
                }
                localStorage.workDay = this.workDay
                this.isShowSelectWorkPopu=false
            },
            selectWorkDay(){
                this.isShowSelectWorkPopu=true
            },
            onCancelWorok(){
                this.isShowSelectWorkPopu=false
            },
            addContent(flag) {
                this.popuLocationFlag = flag
                this.isShowSupportPopu = true
            },
            selectYear() {
                this.isShowSelectPopu = true
            },
            selectYears(){
                this.isShowSelectYearPopu=true
            },
            onConfirm(value) {
                this.supportInfo.yearTime = value
                this.isShowSelectPopu = false
            },
            onConfirmYear(value){
                this.supportInfo.year = value
                this.isShowSelectYearPopu = false
            },
            onCancelYear(){
                this.isShowSelectYearPopu = false
            },
            onCancel() {
                this.isShowSelectPopu = false
            },
            commitSupport() {
                if (this.supportInfo.year == '') {
                    toast('请输入年限')
                    return
                }
                if (this.supportInfo.year.length!=4) {
                    toast('请输入正确年限')
                    return
                }
                if (this.supportInfo.yearTime == '') {
                    toast('请选择时限')
                    return
                }
                if (this.supportInfo.totalNum==""){
                    toast('请输入总件数')
                    return
                }
                if (this.supportInfo.startNum == '') {
                    toast('请输入开始件数')
                    return
                }
                if (this.supportInfo.endNum == '') {
                    toast('请输入结束件数')
                    return
                }
                if (parseInt(this.supportInfo.endNum) < parseInt(this.supportInfo.startNum)) {
                    toast('结束件数不能小于开始件数')
                    return
                }
                this.isShowSupportPopu = false
                this.supportInfo.allInfo = this.supportInfo.year+"年," +
                    this.supportInfo.yearTime+",共"+this.supportInfo.totalNum+ '件,第' + this.supportInfo.startNum + '-' + this.supportInfo.endNum + '件;'
                if (this.popuLocationFlag == 'qiaoCode') {
                    this.info.qiaoMark = this.info.qiaoMark + this.supportInfo.allInfo
                } else if (this.popuLocationFlag == 'qiaoZhang') {
                    this.info.zhangMark = this.info.zhangMark + this.supportInfo.allInfo
                } else if (this.popuLocationFlag == 'lu') {
                    this.info.luMark = this.info.luMark + this.supportInfo.allInfo
                } else if (this.popuLocationFlag == 'scan') {
                    this.info.scanMark = this.info.scanMark + this.supportInfo.allInfo
                } else if (this.popuLocationFlag == 'zhuang') {
                    this.info.zhaungMark = this.info.zhaungMark + this.supportInfo.allInfo
                }
                this.initSupport()
            },
            initSupport() {
                this.supportInfo.yearTime = ''
                this.supportInfo.year = ''
                this.supportInfo.allInfo = ''
                this.supportInfo.startNum = ''
                this.supportInfo.endNum = ''
                this.supportInfo.totalNum=''
            },
            startCommit() {
                if (this.selectProjectId == '') {
                    toast("请选择项目名称")
                    return
                }
                if (this.repairStatus) {
                    if (this.info.repairDate==''){
                        toast("请输入补报日期")
                        return
                    }
                }
                if (!this.workDay){
                    toast("请选择工作量")
                    return
                }
                this.isShowCommitPopu = true
            },
            startSureCommit() {
                showLoading()
                let data = []
                let zl = {
                    name: 'zl',
                    num: parseInt(this.info.zhengNum ? this.info.zhengNum : 0),
                    subNum: 0,
                    text: this.info.zhengMark,
                    unit: '件',
                    subUnit: ''
                }
                data.push(zl)

                let qym = {
                    name: 'qym',
                    num: parseInt(this.info.qiaoNum ? this.info.qiaoNum : 0),
                    subNum: parseInt(this.info.qiaoPage ? this.info.qiaoPage : 0),
                    text: this.info.qiaoMark,
                    unit: '件',
                    subUnit: '页'
                }
                data.push(qym)

                let qz = {
                    name: 'qz',
                    num: parseInt(this.info.zhangNum ? this.info.zhangNum : 0),
                    subNum: 0,
                    text: this.info.zhangMark,
                    unit: '件',
                    subUnit: ''
                }
                data.push(qz)

                let lr = {
                    name: 'lr',
                    num: parseInt(this.info.luNum ? this.info.luNum : 0),
                    subNum: 0,
                    text: this.info.luMark,
                    unit: '件',
                    subUnit: ''
                }
                data.push(lr)

                let sm = {
                    name: 'sm',
                    num: parseInt(this.info.scanNum ? this.info.scanNum : 0),
                    subNum: parseInt(this.info.scanPage ? this.info.scanPage : 0),
                    text: this.info.scanMark,
                    unit: '件',
                    subUnit: '页'
                }
                data.push(sm)

                let zd = {
                    name: 'zd',
                    num: parseInt(this.info.zhaungNum ? this.info.zhaungNum : 0),
                    subNum: 0,
                    text: this.info.zhaungMark,
                    unit: '件',
                    subUnit: ''
                }
                data.push(zd)

                let qt = {
                    name: 'qt',
                    num: 0,
                    subNum: 0,
                    text: this.info.otherMark
                }
                data.push(qt)

                let params = {
                    reportJson: JSON.stringify(data),
                    projectId: this.selectProjectId,
                    reportType:this.projectType
                }
                params.workDay=this.workDay
                if (this.infoId) {
                    params.infoId = this.infoId
                }
                if (this.repairStatus) {
                    params.repairStatus = true;
                    params.repairDate = this.info.repairDate;
                }
                let callBack = (res) => {
                    dismissLoading()
                    if (this.repairStatus){
                        if (this.infoId) {
                            nofity("申请更新成功,等待审核")
                        }else {
                            nofity("申请成功,等待审核")
                        }
                    }else {
                        if (this.infoId) {
                            nofity("修改成功")
                        }else {
                            nofity("填报成功")
                        }
                    }
                    this.isShowCommitPopu = false
                    setTimeout(() => {
                        if (this.repairStatus){
                            if (this.infoId) {
                                this.$router.back(-1)
                            }else {
                                this.$router.push({
                                    name: "repairRecord",
                                    query: {
                                        tabActive: '0'
                                    }
                                })
                            }
                        }else {
                            if (this.infoId) {
                                this.$router.back(-1)
                            }else {
                                this.$router.push({
                                    name: "record",
                                    query: {
                                        tabActive: this.projectType=='book'?'0':'3'
                                    }
                                })
                            }
                        }

                        this.initData()
                    }, 1100)
                }
                let errback = () => {
                    dismissLoading()
                }
                if (this.infoId) {
                    if (this.modifyManager>1){
                        this.$request('POST', "/api/mobile/report/modifyReportInfoForAdmin", params, callBack, this, errback)
                    }else {
                        this.$request('POST', "/api/mobile/report/modifyReportInfo", params, callBack, this, errback)
                    }
                } else {
                    this.$request('POST', "/api/mobile/report/addReport", params, callBack, this, errback)
                }
            },
            initData() {
                this.selectProjectName = ''
                this.selectProjectId = ''
                this.info.zhengNum = ''
                this.info.zhengMark = ''
                this.info.qiaoNum = ''
                this.info.qiaoPage = ''
                this.info.qiaoMark = ''
                this.info.zhangNum = ''
                this.info.zhangMark = ''
                this.info.luNum = ''
                this.info.luMark = ''
                this.info.scanNum = ''
                this.info.scanPage = ''
                this.info.scanMark = ''
                this.info.zhaungNum = ''
                this.info.zhaungMark = ''
                this.info.otherMark = ''
                this.repairStatus = false
                this.isShowCommitPopu = false
                this.infoId = ""
                this.info.repairDate=''
                this.projectType=''
                this.modifyManager=0
                this.isSelectProject=false
                this.workDay=''
            },
            getRecordById() {
                showLoading("获取中...")
                let params = {
                    infoId: this.infoId
                }
                let callBack = (res) => {
                    this.selectProjectName = res.projectName
                    this.selectProjectId = res.projectId
                    this.info.repairDate=res.reportDate
                    this.projectType=res.reportType
                    this.workDay=res.workDay
                    if (res.reportData.zl) {
                        this.info.zhengNum = res.reportData.zl.num ? res.reportData.zl.num : ''
                        this.info.zhengMark = res.reportData.zl.text
                    }
                    if (res.reportData.qym) {
                        this.info.qiaoNum = res.reportData.qym.num ? res.reportData.qym.num : ''
                        this.info.qiaoPage = res.reportData.qym.subNum ? res.reportData.qym.subNum : ''
                        this.info.qiaoMark = res.reportData.qym.text
                    }
                    if (res.reportData.qz) {
                        this.info.zhangNum = res.reportData.qz.num ? res.reportData.qz.num : ''
                        this.info.zhangMark = res.reportData.qz.text
                    }
                    if (res.reportData.lr) {
                        this.info.luNum = res.reportData.lr.num ? res.reportData.lr.num : ''
                        this.info.luMark = res.reportData.lr.text
                    }
                    if (res.reportData.sm) {
                        this.info.scanNum = res.reportData.sm.num ? res.reportData.sm.num : ''
                        this.info.scanPage = res.reportData.sm.subNum ? res.reportData.sm.subNum : ''
                        this.info.scanMark = res.reportData.sm.text
                    }
                    if (res.reportData.zd) {
                        this.info.zhaungNum = res.reportData.zd.num ? res.reportData.zd.num : ''
                        this.info.zhaungMark = res.reportData.zd.text
                    }
                    if (res.reportData.qt) {
                        this.info.otherMark = res.reportData.qt.text
                    }
                    dismissLoading()
                }
                let errback = () => {
                    dismissLoading()
                }
                this.$request('POST', "/api/mobile/report/find", params, callBack, this, errback)
            }
        },
        activated() {
            if (sessionStorage.getItem("selectProject")) {
                let selectData = JSON.parse(sessionStorage.getItem("selectProject"))
                this.isSelectProject=true
                this.selectProjectName = selectData.projectName
                this.selectProjectId = selectData.projectId
                sessionStorage.removeItem("selectProject")
            } 
            else if(localStorage.selectProject){
                let selectData = JSON.parse(localStorage.selectProject)
                this.isSelectProject=true
                this.selectProjectName = selectData.projectName
                this.selectProjectId = selectData.projectId
            }
            else {
                this.initData()
            }
            if (localStorage.workDay){
                this.workDay = localStorage.workDay
                this.workOpen = true
            }
            if (this.$route.query.type > 0) {
                this.repairStatus = true;
            }else {
                this.repairStatus = false;
            }
            console.log(this.$route.query)
            if (this.$route.query.modifyByManager > 1) {
                this.modifyManager = 100;
            }else {
                this.modifyManager = 0;
            }
            if (this.$route.query.infoId) {
                this.infoId = this.$route.query.infoId
                if (!this.isSelectProject){
                    this.getRecordById()
                }
            }
            if (this.$route.query.projectType) {
                this.projectType = this.$route.query.projectType
                if (this.projectType=='book'){
                    this.headTitle="文书档案"
                }else if (this.projectType=="special"){
                    this.headTitle="特种载体档案"
                }
            }
            this.screenHeight = document.documentElement.clientHeight
            if (this.screenHeight > 0) {
                this.commitPopuHeight = this.screenHeight - 80
            }
        }
    }
</script>

<style scoped lang="scss">
    .office-wrap {
        min-height: 100vh;
        background: $page-bg;
        padding-top: $header-top;
        box-sizing: border-box;

        .office-content {
            background: white;
            padding: 0 12px;
            display: flex;
            align-items: flex-start;
            justify-content: flex-start;

            .item-title {
                width: 58px;
                font-size: 17px;
                color: $main-color;
                padding-top: 12px;
                flex-shrink: 0;
                font-weight: 600;
            }

            .item-content {
                flex: 1;

                .office-desc {
                    display: flex;
                    align-items: flex-start;
                    justify-content: flex-start;

                    .office-desc-input {
                        flex: 1;
                    }

                    .office-desc-add {
                        width: 30px;
                        height: 30px;
                        margin-top: 12px;
                    }
                }
            }
        }

        .office-commit {
            width: 90%;
            height: 45px;
            margin: 20px auto 30px;
            border-radius: 45px;
            background: $main-color;
            font-size: 18px;
            text-align: center;
            line-height: 45px;
            color: #ffffff;
        }


        .support-popu {
            width: 100%;
            padding: 30px 20px 0;
            box-sizing: border-box;

            .support-year {
                width: 100%;
                height: 50px;
                display: flex;
                align-items: center;
                justify-content: flex-start;

                .year-left {
                    color: #646566;
                    font-size: 15px;
                    width: 85px;
                    flex-shrink: 0;
                }

                .year-right {
                    color: #323233;
                    font-size: 15px;
                    flex: 1;
                }
            }

            .support-add {
                width: 90%;
                height: 45px;
                margin: 20px auto 30px;
                border-radius: 45px;
                background: $main-color;
                font-size: 18px;
                text-align: center;
                line-height: 45px;
                color: #ffffff;
            }
        }

        .line {
            width: 100%;
            height: 1px;
            background: $line-color;
            transform: scaleY(0.5);
            -webkit-transform: scaleY(0.5);
        }

        .person-commit {
            width: 90%;
            height: 45px;
            margin: 20px auto 30px;
            border-radius: 45px;
            font-size: 18px;
            text-align: center;
            line-height: 45px;
            color: #ffffff;
        }

        .office-content-repair {
            background: white;
            padding: 0 12px;
            display: flex;
            align-items: center;
            justify-content: flex-start;

            .repair-title {
                width: 58px;
                display: flex;
                align-items: flex-start;
                justify-content: flex-start;
                flex-direction: column;
                font-size: 17px;
                color: $main-color;
                flex-shrink: 0;
                font-weight: 600;
                padding: 10px 0;
            }

            .item-content {
                flex: 1;
            }
        }

        .commit-show {
            width: 100%;

            .commit-title {
                width: 100%;
                height: 55px;
                line-height: 55px;
                text-align: center;
                color: #323233;
                font-size: 17px;
            }

            .commit-item {
                background: white;
                padding: 0 12px;
                display: flex;
                align-items: flex-start;
                justify-content: flex-start;

                .commit-item-title {
                    width: 75px;
                    font-size: 17px;
                    color: $main-color;
                    flex-shrink: 0;
                }

                .commit-item-content {
                    display: flex;
                    align-items: flex-start;
                    justify-content: flex-start;
                    flex-direction: column;
                    color: #646566;
                    font-size: 15px;
                    word-break: break-all;
                }
            }

            .person-commit-notice {
                width: 90%;
                height: 45px;
                margin: 20px auto 16px;
                border-radius: 45px;
                font-size: 18px;
                text-align: center;
                line-height: 45px;
                color: #ffffff;
            }
        }
        .item-arrow-down{
            height: 40px;
            width: 100%;
            padding-right: 12px;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            font-size: 13px;
            border-bottom: 1px solid #F5F6F7;
            span{
                margin-right: 20px;
            }
        }
        .work-day{
            width: 100%;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: flex-start;

            .work-day-title{
                font-size: 14px;
                color: #646566;
                flex-shrink: 0;
            }
            .work-day-select{
                width: 100%;
                height: 100%;
                line-height: 50px;
                font-size: 16px;
                color: #323233;
                padding-left: 40px;
            }
        }
    }
</style>